package com.woniuxy.service.daily.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.dao.UpkeepMapper;
import com.woniuxy.pojo.Upkeep;
import com.woniuxy.service.daily.UpkeepService;
@Service
@Transactional
public class UpkeepServiceImpl implements UpkeepService {
	@Autowired
	private UpkeepMapper upkeepMapper;
	
	@Override
	public PageInfo getAllUpkeep(Integer uk_pn, String uk_conditionBy, String uk_condition) {
		// TODO Auto-generated method stub
		PageHelper.startPage(uk_pn,4);
		List<Upkeep> l=upkeepMapper.selectAllUpkeep(uk_conditionBy, uk_condition);
		PageInfo pageInfo =new PageInfo(l,3);
		return pageInfo;
	}

	@Override
	public void addUpkeep(Upkeep up) {
		// TODO Auto-generated method stub
		upkeepMapper.insert(up);
	}

	@Override
	public Upkeep getOneUpkeep(Integer upId) {
		// TODO Auto-generated method stub
		
		return upkeepMapper.selectByPrimaryKey(upId);
	}

	@Override
	public void updUpkeep(Upkeep up) {
		// TODO Auto-generated method stub
		upkeepMapper.updateByPrimaryKey(up);
	}

	@Override
	public void deleteOne(Integer upId) {
		// TODO Auto-generated method stub
		upkeepMapper.deleteByPrimaryKey(upId);
	}

	@Override
	public int deleteMany(String[] upId) {
		// TODO Auto-generated method stub
		
		return upkeepMapper.deleteMany(upId);
	}

}
